import { default as request, cloud } from '@/framework/utils/request'

// 查询列表
export function listreleaseMag(query) {
  return request({
    url: cloud.dqbasic + '/flowable/page',
    method: 'get',
    params: query
  })
}

// 查看流程
export function readImage(deploymentId) {
  return request({
    url: cloud.dqbasic + '/flowable/readImage?deploymentId=' + deploymentId,
    method: 'get'
  })
}

// 发布详情
export function detail(processKey) {
  return request({
    url: cloud.dqbasic + '/sysProcessEntrance/detail?processKey=' + processKey,
    method: 'get'
    // data: { deploymentId: deploymentId }
  })
}

// 发布
export function Release(data) {
  return request({
    url: cloud.dqbasic + '/flowable/publish',
    method: 'post',
    data: data
  })
}

// 挂起
export function updateState(deploymentId, status) {
  return request({
    url: cloud.dqbasic + '/flowable/updateState',
    method: 'post',
    data: { deploymentId: deploymentId, status: status }
  })
}

// 删除
export function delreleaseMag(deploymentId) {
  return request({
    url: cloud.dqbasic + '/flowable/delete',
    method: 'post',
    data: { deploymentId: deploymentId }
  })
}
// 获取流程类型列表
export function categoryList(query) {
  return request({
    url: cloud.dqbasic + '/sysProcessCategory/list',
    method: 'get',
    params: query
  })
}

// 改变状态
export function changeStatus(data) {
  return request({
    url: cloud.dqbasic + '/flowable/enableEntrance',
    method: 'post',
    data: data
  })
}
